#include"processbar.h"
#include<string.h>
char bar[NUM] = {0};
char* point = "|/-\\";

void processbar(int rate)
{
    if(rate < 0 || rate > 100) return;
    printf("[%-100s][%d%%][%c]\r",bar,rate,point[rate%4]);
    fflush(stdout);
    bar[rate++] = STYLE;
    if(rate < 100) bar[rate] = RIGHT;
    
}

void initbar()
{
    memset(bar,'\0',sizeof(bar));
}

